﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Http;

namespace AhCha.Fortunate.Common.Utility
{
    public class FortunateException : Exception
    {
        public FortunateException() : base() { }
        public FortunateException(string message, object errorCode) : base(message)
        {
            ErrorMessage = message;
            ErrorCode = OriginErrorCode = errorCode;
        }
        /// <summary>
        /// 错误码
        /// </summary>
        public object ErrorCode { get; set; }
        /// <summary>
        /// 错误码（没被复写过的 ErrorCode ）
        /// </summary>
        public object OriginErrorCode { get; set; }
        /// <summary>
        /// 错误消息（支持 Object 对象）
        /// </summary>
        public object ErrorMessage { get; set; }
        /// <summary>
        /// 状态码
        /// </summary>
        public int StatusCode { get; set; } = StatusCodes.Status500InternalServerError;
        /// <summary>
        /// 是否是数据验证异常
        /// </summary>
        public bool ValidationException { get; set; } = false;
    }
}
